class Commidity:
    def __init__(self, name, price):
        self.name = name
        self.price = price

    def __str__(self):
        return f"Name: {self.name}, Price: {self.price}"

    def add_to_cart(self, cart):
        cart.add_item(self)


class Cart:
    def __init__(self):
        self.items = []

    # def __str__(self):
    #     return f'{self.items}'

    def show_items(self):
        for i in self.items:
            print(i)

    def add_item(self, commidity):
        self.items.append(commidity)


if __name__ == "__main__":
    cart1 = Cart()
    cup = Commidity("Cup", 100)
    phone = Commidity("Phone", 1000)
    cart1.add_item(cup)
    phone.add_to_cart(cart1)
    cart1.show_items()

